package com.example.myapplication;

import android.os.Bundle;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

public class ReminderDialogActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // 获取传递的数据
        String title = getIntent().getStringExtra("title");
        String message = getIntent().getStringExtra("message");

        // 创建 Material Design 对话框
        new AlertDialog.Builder(this, com.google.android.material.R.style.ThemeOverlay_MaterialComponents_Dialog_Alert)
                .setTitle(title != null ? title : "通知") // 设置标题
                .setMessage(message != null ? message : "无内容") // 设置内容
                .setPositiveButton("确定", (dialog, which) -> finish()) // 确认按钮
                .setOnDismissListener(dialog -> finish()) // 确保对话框消失时关闭 Activity
                .show();
    }
}
